package com.cowain.base.controller.system;


import com.cowain.base.core.controller.BaseController;
import com.cowain.base.core.domain.AjaxResult;
import com.cowain.base.core.domain.vo.SysRoleVo;
import com.cowain.system.service.SysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 角色信息
 *
 * @author ruoyi
 */
@Api(tags = {"角色"})
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController {
    @Autowired
    private SysRoleService sysRoleService;

    @ApiOperation("新增")
    @PostMapping
    public AjaxResult add(@Validated @RequestBody SysRoleVo role) {
        return toAjax(sysRoleService.add(role));
    }

    /**
     * 修改保存角色
     */
    @ApiOperation("修改")
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody SysRoleVo role) {
        return toAjax(sysRoleService.edit(role));
    }
}
